/**
 *  fileName:testyouxianji
 *  time:2023/4/10
 *  todo:$END$
 */
// js中a || b ? c : d 的执行顺序是(a || b) ? c : d，还是 a || (b ? c : d)

let a = 1,b = 2,c = 3, d = 4

console.log(`a || b ? c : d ==> `, a || b ? c : d)
console.log(`(a || b) ? c : d ==> `, (a || b) ? c : d)
console.log(`a || (b ? c : d) ==> `, a || (b ? c : d))

let arr = [{datacount: 1}, {datacount: 2}, {datacount: 3}];
let sum = arr.reduce((acc, cur, index) => {
  console.log(`acc, cur, index ==> `, acc, cur, index)
  return acc + cur.datacount
  // return (index === 1 ? acc.datacount : acc) + cur.datacount
},0);
console.log(sum); // 输出6
